<?php

namespace App\Service;

class GameService
{
    /**
     * [addVip 发送加vip].
     *
     * @Author   王文凡
     * @DateTime 2018-04-20
     *
     * @version  1.0
     *
     * @param interger $server_id    [游戏服id]
     * @param string   $role_name    [角色名]
     * @param int      $fairy_num    [仙晶数量]
     * @param int      $integral_num [积分数量]
     * @param int      $min_level    [最小等级]
     * @param int      $max_level    [最大等级]
     * @param int      $exp_time     [领取过期时间]
     */
    public static function addVip($server_id, $role_name = '', $fairy_num = 0, $integral_num = 0, $min_level = 0, $max_level = 0, $exp_time = 0,$type)
    {
        $identy_id = 1;
        if ($fairy_num) {
            //加仙晶数量
            $op = "{$type};{$identy_id};{$role_name};#setviplevel {$fairy_num};{$min_level};{$max_level};{$exp_time}";
            $ret = RequestService::sendVip($op, $server_id);
            if (!$ret) {
                return false;
            }
        }
        if ($integral_num) {
            //积分
            $op = "{$type};{$identy_id};{$role_name};#setviplevelonly {$integral_num};{$min_level};{$max_level};{$exp_time}";
            $ret = RequestService::sendVip($op, $server_id);
            if (!$ret) {
                return false;
            }
        }

        return true;
    }
}
